package com.beiding.jsonanalyzer.analyze.func.funckey;

import com.beiding.jsonanalyzer.Key;
import com.beiding.jsonanalyzer.analyze.func.FuncBase;
import com.beiding.jsonanalyzer.analyze.func.FuncFactory;
import com.beiding.jsonanalyzer.analyze.func.OneFunc;
import com.beiding.jsonanalyzer.analyze.func.openfunc.FuncUtils;

/**
 * 自带函数和查询
 *
 * @author 丁常磊
 * @date 2022/6/25 12:38
 */

public class FuncAbleKey implements OneFunc,FuncFactory {

    private FuncFactory funcFactory;

    public FuncAbleKey(String key) {
        funcFactory = FuncUtils.ensureFuncFactory(Key.parse(key));
    }

    @Override
    public Object getSelf() {
        return this;
    }

    @Override
    public FuncBase createInstance() {
        return funcFactory.createInstance();
    }
}
